diff options
author | 2021-12-22 16:11:05 -0500 | |
---|---|---|
committer | 2021-12-22 16:11:05 -0500 | |
commit | 6ddd7678ffb6598ae6e263706813cb5e94535f02 (patch) | |
tree | d4b45f7590b59c3574bd6593b17d8066f71007c6 /examples/blog-multiple-authors/src/pages/posts/[...page].astro | |
parent | 305ce4182fbe89abcfb88008ddce178bd8863b6a (diff) | |
download | astro-6ddd7678ffb6598ae6e263706813cb5e94535f02.tar.gz astro-6ddd7678ffb6598ae6e263706813cb5e94535f02.tar.zst astro-6ddd7678ffb6598ae6e263706813cb5e94535f02.zip |
Use accessible indentation (#2253)
Diffstat (limited to 'examples/blog-multiple-authors/src/pages/posts/[...page].astro')
-rw-r--r-- | examples/blog-multiple-authors/src/pages/posts/[...page].astro | 108 |
1 files changed, 50 insertions, 58 deletions
diff --git a/examples/blog-multiple-authors/src/pages/posts/[...page].astro b/examples/blog-multiple-authors/src/pages/posts/[...page].astro index b615d762f..d0f95ce5b 100644 --- a/examples/blog-multiple-authors/src/pages/posts/[...page].astro +++ b/examples/blog-multiple-authors/src/pages/posts/[...page].astro @@ -5,26 +5,26 @@ import PostPreview from '../../components/PostPreview.astro'; import Pagination from '../../components/Pagination.astro'; import authorData from '../../data/authors.json'; -export async function getStaticPaths({paginate, rss}) { - const allPosts = Astro.fetchContent<MarkdownFrontmatter>('../post/*.md'); - const sortedPosts = allPosts.sort((a, b) => new Date(b.date).valueOf() - new Date(a.date).valueOf()); +export async function getStaticPaths({ paginate, rss }) { + const allPosts = Astro.fetchContent<MarkdownFrontmatter>('../post/*.md'); + const sortedPosts = allPosts.sort((a, b) => new Date(b.date).valueOf() - new Date(a.date).valueOf()); - // Generate an RSS feed from this collection of posts. - // NOTE: This is disabled by default, since it requires `buildOptions.site` to be set in your "astro.config.mjs" file. - // rss({ - // title: 'Don’s Blog', - // description: 'An example blog on Astro', - // customData: `<language>en-us</language>`, - // items: sortedPosts.map(item => ({ - // title: item.title, - // description: item.description, - // link: item.url, - // pubDate: item.date, - // })), - // }); + // Generate an RSS feed from this collection of posts. + // NOTE: This is disabled by default, since it requires `buildOptions.site` to be set in your "astro.config.mjs" file. + // rss({ + // title: 'Don’s Blog', + // description: 'An example blog on Astro', + // customData: `<language>en-us</language>`, + // items: sortedPosts.map(item => ({ + // title: item.title, + // description: item.description, + // link: item.url, + // pubDate: item.date, + // })), + // }); - // Return a paginated collection of paths for all posts - return paginate(sortedPosts, {pageSize: 1}); + // Return a paginated collection of paths for all posts + return paginate(sortedPosts, { pageSize: 1 }); } // page @@ -34,55 +34,47 @@ let canonicalURL = Astro.request.canonicalURL; // collection interface MarkdownFrontmatter { - date: number; - description: string; - title: string; + date: number; + description: string; + title: string; } - const { page } = Astro.props; --- <html lang="en"> - <head> - <title>{title}</title> - <MainHead - title={title} - description={description} - image={page.data[0].image} - canonicalURL={canonicalURL.toString()} - prev={page.url.prev} - next={page.url.next} - /> + <head> + <title>{title}</title> + <MainHead {title} {description} image={page.data[0].image} canonicalURL={canonicalURL.toString()} prev={page.url.prev} next={page.url.next} /> - <style lang="scss"> - .title { - font-size: 3em; - letter-spacing: -0.04em; - margin-top: 2rem; - margin-bottom: 0; - text-align: center; - } + <style lang="scss"> + .title { + font-size: 3em; + letter-spacing: -0.04em; + margin-top: 2rem; + margin-bottom: 0; + text-align: center; + } - .count { - font-size: 1em; - display: block; - text-align: center; - } - </style> - </head> + .count { + font-size: 1em; + display: block; + text-align: center; + } + </style> + </head> - <body> - <Nav title={title} /> + <body> + <Nav {title} /> - <main class="wrapper"> - <h2 class="title">All Posts</h2> - <small class="count">{page.start + 1}–{page.end + 1} of {page.total}</small> - {page.data.map((post) => <PostPreview post={post} author={authorData[post.author]} />)} - </main> + <main class="wrapper"> + <h2 class="title">All Posts</h2> + <small class="count">{page.start + 1}–{page.end + 1} of {page.total}</small> + {page.data.map((post) => <PostPreview post={post} author={authorData[post.author]} />)} + </main> - <footer> - <Pagination prevUrl={page.url.prev} nextUrl={page.url.next} /> - </footer> - </body> + <footer> + <Pagination prevUrl={page.url.prev} nextUrl={page.url.next} /> + </footer> + </body> </html> |